import request  from '@/utils/request'

// 添加商品到购物车
export function addOrderToCart(params) {
    return request({
        method: 'post',
        url: 'carts/add/' + params.order_id,
    })
}

// 购物车删除商品
export function cartDeleteOrder(params) {
    return request({
        method: 'delete',
        url: 'carts/delete/' + params.order_id,
    })
}

// 展示购物车列表
export function cartShow() {
    return request({
        method: 'get',
        url: 'carts/list',
    })
}

// 更新商品数量  /cart/update/{id}/{count}
export function updateGoodsCount(params) {
    return request({
        method: 'put',
        url: `/carts/update/${params.id}/${params.count}`,
    })
}


//添加订单
export function addOrder(params) {
    return request({
        method: 'post',
        url: `carts/commitOrder/${params.addId}/${params.count}`,
        data: params.data,
    })
}